package cn.wudl.tags.models.rule

import cn.wudl.tags.models.{AbstractModel, ModelType}
import cn.wudl.tags.tools.TagTools
import org.apache.spark.sql.DataFrame

/**
 * 标签模型开发：用户国籍标签模型
 */
class NationalityTagModel extends AbstractModel("国籍标签", ModelType.MATCH) {


  override def doTag(businessDF: DataFrame, tagDF: DataFrame): DataFrame = {
    import businessDF.sparkSession.implicits._
    businessDF.printSchema()
    businessDF.show(10, truncate = false)

    tagDF.printSchema()
    tagDF.filter($"level" === 5).show(10, truncate = false)

    val modelDF: DataFrame = TagTools.ruleMatchTag(
      businessDF, "nationality", tagDF
    )
    modelDF.show(10, truncate = false)

    // 返回画像标签数据
    modelDF
  }
}


object NationalityTagModel {
  def main(args: Array[String]): Unit = {
    val tagModel = new NationalityTagModel()
    tagModel.executeModel(332L)
  }
}